<?php 
namespace Home\Model;
use Think\Model;
class GuessModel extends Model 
{
    public function getMyGuess($sleepingId, $openid)
    {
        $where = array(
            'sleeping_id'=>$sleepingId,
            'openid'=>$openid
        );
        return $this->where($where)->find();
    }
    public function addGuess($sleepingId, $sleepingType, $right, $openid)
    {
        $add = array(
            'sleeping_id'   => $sleepingId,
            'sleeping_type' => $sleepingType,
            'right'         => $right,
            'create_time'   => time(),
            'openid'        => $openid,
        );
        return $this->add($add);
    }
}
